﻿using System;

namespace CoreRay
{
    //-----------------------------------------------------------------------------------------
    /// <summary>
    /// Represents a render region of the final rendered image.
    /// </summary>
    //-----------------------------------------------------------------------------------------

    public class RenderRegion
    {
        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderRegion"/> class.
        /// </summary>
        /// <param name="positionX">The x position of the render region.</param>
        /// <param name="positionY">The y position of the render region.</param>
        /// <param name="width">The width of the render region.</param>
        /// <param name="height">The height of the render region.</param>
        //-----------------------------------------------------------------------------------------

        public RenderRegion(int positionX, int positionY, int width, int height)
        {
            if (positionX < 0)
            {
                throw new ArgumentException("Position X cannot be negative.", "positionX");
            }

            if (positionY < 0)
            {
                throw new ArgumentException("Position Y cannot be negative.", "positionY");
            }

            if (width < 0)
            {
                throw new ArgumentException("Width cannot be negative.", "width");
            }

            if (height < 0)
            {
                throw new ArgumentException("Height cannot be negative.", "height");
            }

            this.PositionX = positionX;
            this.PositionY = positionY;
            this.Width = width;
            this.Height = height;
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the x position of the render region.
        /// </summary>
        /// <value>The x position of the render region.</value>
        //-----------------------------------------------------------------------------------------

        public int PositionX
        {
            get;
            private set;
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the y position of the render region.
        /// </summary>
        /// <value>The y position of the render region.</value>
        //-----------------------------------------------------------------------------------------

        public int PositionY
        {
            get;
            private set;
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the width of the render region.
        /// </summary>
        /// <value>The width of the render region.</value>
        //-----------------------------------------------------------------------------------------

        public int Width
        {
            get;
            private set;
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the height of the render region.
        /// </summary>
        /// <value>The height of the render region.</value>
        //-----------------------------------------------------------------------------------------

        public int Height
        {
            get;
            private set;
        }
    }
}
